﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Html5VideoDemo.Utility
{
    public static class EncryptUtil
    {
        public static String GetMd5(String strSource)
        {
            String strResult = "";

            //Create  
            System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create();

            //注意编码UTF8、UTF7、Unicode等的选择,一般用UTF8　  
            byte[] bytResult = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(strSource));

            //字节类型的数组转换为字符串  
            for (int i = 0; i < bytResult.Length; i++)
            {
                //16进制转换   
                strResult = strResult + bytResult[i].ToString("X");
            }
            return strResult;
        }
    }
}